<!--
  ~ The MIT License (MIT)
  ~
  ~ Copyright (c) 2019 ‭‭‭‭‭‭‭‭‭‭‭‭[smallbun] www.smallbun.org
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy of
  ~ this software and associated documentation files (the "Software"), to deal in
  ~ the Software without restriction, including without limitation the rights to
  ~ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  ~ the Software, and to permit persons to whom the Software is furnished to do so,
  ~ subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  ~ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  ~ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  ~ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  ~ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  -->

<!DOCTYPE HTML>
<!--suppress ALL-->
<html lang="zh-cn"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <div th:include="fragments/include  :: header('通知公告')"></div>
</head>
<body>
<div class="i-ibox">
    <div class="ibox-content">
        <form id="form" class="form-horizontal" th:action="@{/notify/saveOrUpdate}" th:object="${notify}"
              method="post">
            <!--隐藏域ID-->
            <input id="id" name="id" type="hidden" th:field="*{id}">
            <h4 class="page-header h4">基本信息</h4>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><span
                                style="color: red;">*</span>标题：</label>
                        <div class="col-xs-9">
                            <div class="input-group" style="width: 100%">
                                <div class="input-group" style="width: 100%">
                                    <input id="typeName" placeholder="请输入公告标题"
                                           class="form-control required" th:field="*{title}"
                                           type="text" required autocomplete="off">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><span
                                style="color: red;">*</span>类型：</label>
                        <div class="col-xs-9">
                            <div class="input-group" style="width: 100%">
                                <select name="notifyGenre" id="notifyGenre" class="form-control select2 required"
                                        th:with="type=${@smallbun.dict('NOTIFY_GENRE')}">
                                    <option value="">请选择公告类型</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                            th:value="${dict.dictValue}" th:field="*{notifyGenre}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12" style="display:none;" id="content_row">
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><span
                                style="color: red;">*</span>内容：</label>
                        <div class="col-xs-9">
                            <div class="input-group" id="content"  style="z-index: 1000"></div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><span
                                style="color: red;">*</span>状态：</label>
                        <div class="col-xs-9">
                            <div class="input-group">
                                <label class="label-radio" required
                                       th:each="dict : ${@smallbun.dict('NOTIFY_STATUS')}">
                                    <input type="radio" class="minimal"
                                           th:value="${dict.dictValue}" required th:field="*{notifyStatus}">
                                    <label th:text="${dict.dictLabel}"></label>
                                </label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><span
                                style="color: red;">*</span>接收人：</label>
                        <div class="col-xs-9">
                            <div class="input-group" style="width: 100%">
                                <div class="input-group" style="width: 100%">
                                    <input readonly="readonly"  idObj="#receiverId" th:field="*{receiverName}" onclick="$.select.selectUser(this)"
                                                                          placeholder="请选择接收人"
                                                                          class="form-control"/>
                                    <span class="input-group-addon" onclick="$.select.selectUser(this)">
                                        <i class="fa fa-search"></i>
                                    </span>
                                    <input type="hidden" id="receiverId" name="receiverId">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="box-footer">
        <div class="row">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-sm ibtn-primary" onclick="doSubmit()" id="btn-submit">
                    <i class="fa fa-check"></i>
                    保 存
                </button>&nbsp;
                <button type="button" class="btn btn-sm btn-default" id="btn-cancel"
                        onclick="parent.closeCurrentTabPage(window)">
                    <i class="fa fa-reply-all"></i>
                    关 闭
                </button>
            </div>
        </div>
    </div>
</div>
</body>
<div th:include="fragments/include :: include-js"></div>
<div th:include="fragments/include :: neditor-js"></div>
<div th:include="fragments/include :: jquery-validate-js"></div>
<script th:src="@{/static/modules/manage/js/notify/notify_form.js}"></script>
<script th:inline="javascript">
    var content = [[${notify.content}]];
    if(content !=null) {
        editor.ready(function () {
            editor.setContent(content);
        });
    }
</script>
</html>